package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "商品SKU", model = "商品SKU")
@Entity
@Table(name = "bs_product_sku")
@Comment("商品SKU表")
public class ProductSku extends AbstractEntity {

    @Comment("商品ID")
    @FormField(title = "商品ID", sortNum = "1", grid = true, required = true)
    private Long productId;

    @Comment("SKU编码")
    @SearchItem(name = "skuCode", key = "skuCode", label = "SKU编码")
    @FormField(title = "SKU编码", sortNum = "2", grid = true, required = true)
    @Column(length = 100, nullable = false, unique = true)
    private String skuCode;

    @Comment("SKU名称")
    @FormField(title = "SKU名称", sortNum = "3", grid = true)
    @Column(length = 200)
    private String skuName;

    @Comment("规格组合")
    @FormField(title = "规格组合", sortNum = "4", grid = true)
    @Column(length = 500)
    private String specifications;

    @Comment("规格JSON")
    @FormField(title = "规格JSON", sortNum = "5", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String specificationJson;

    @Comment("SKU图片")
    @FormField(title = "SKU图片", sortNum = "6", type = InputType.image)
    @Column(length = 500)
    private String image;

    @Comment("价格")
    @FormField(title = "价格", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 10, scale = 2)
    private BigDecimal price;

    @Comment("市场价")
    @FormField(title = "市场价", sortNum = "8", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal marketPrice;

    @Comment("成本价")
    @FormField(title = "成本价", sortNum = "9", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal costPrice;

    @Comment("库存数量")
    @FormField(title = "库存数量", sortNum = "10", grid = true, type = InputType.el_input_number, sort = true)
    private Integer stock;

    @Comment("预警库存")
    @FormField(title = "预警库存", sortNum = "11", grid = true, type = InputType.el_input_number)
    private Integer warningStock;

    @Comment("销量")
    @FormField(title = "销量", sortNum = "12", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sales;

    @Comment("重量(克)")
    @FormField(title = "重量(克)", sortNum = "13", grid = true, type = InputType.el_input_number)
    private Integer weight;

    @Comment("体积(立方厘米)")
    @FormField(title = "体积(立方厘米)", sortNum = "14", grid = true, type = InputType.el_input_number)
    private Integer volume;

    @Comment("SKU状态")
    @FormField(title = "SKU状态", sortNum = "15", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // ON_SALE-上架, OFF_SALE-下架

    @Comment("排序")
    @FormField(title = "排序", sortNum = "16", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "17", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 